import request from "@/apps/admin/units/request"
import {HttpResultData,HttpResult} from "@/types/project";//导入基本分页数据结构

/**
 * 角色权限
 */
export const PERMISSIONS = {
    VIEW: 'administer.role.list',
    ADD: 'administer.role.created',
    EDIT: 'administer.role.updated',
    DEL: 'administer.role.remove'
}


/**
 * 获取角色信息
 */
export function getRoleListApi<T>(where: any): Promise<HttpResultData<T>> {
    return request(`/administer-role/list`, where);
}


/**
 * 创建角色
 */
export const createdRoleApi = (data: any): Promise<HttpResultData<any>> => request(`/administer-role/created`, data, 'POST')


/**
 * 编辑角色
 */
export const updatedRoleApi = (data: any): Promise<HttpResultData<any>> => request(`/administer-role/updated`, data, 'POST')


/**
 * 删除角色
 */
export const removeRoleApi = (id: number): Promise<HttpResultData<any>> => request(`/administer-role/remove`, {id}, 'POST')


/**
 * 删除角色
 */
export const getRoleDetailsApi = (id: number): Promise<HttpResultData<any>> => request(`/administer-role/details`, {id})


/**
 * 更改角色状态
 * @param id
 * @param status
 */
export const changeStatusApi = (id: number, status: 0 | 1): Promise<HttpResultData<any>> => request(`/administer-role/details`, {id, status}, 'POST')